<% if notice %>
<p id="notice"><%= notice %></p>
<% end %>

<h1>Listing borrowings</h1>

<table>
  <tr>
    <th>User</th>
    <th>Document ISBN</th>
    <th>Document name</th>
    <th>Borrow date</th>
    <th>Borrow date number</th>
    <th>Extension</th>
    <th>Return date</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @borrowings.each do |borrowing| %>
  <tr>
    <td><%= borrowing.user_id %></td>
    <td><%= borrowing.document_id %></td>
    <td><%= borrowing.document_name %></td>
    <td><%= borrowing.borrow_date.strftime("%d/%m/%Y") %></td>
    <td><%= borrowing.borrow_date_number %></td>
    <td><%= borrowing.extension %></td>
    <td>
    	<% if borrowing.return_date %>
    		<%=borrowing.return_date.strftime("%d/%m/%Y") %>
    	<% end %>
    </td>
    <td><%= link_to 'Show', borrowing %></td>
    <td><%= link_to 'Edit', edit_borrowing_path(borrowing) %></td>
    <td><%= link_to 'Destroy', borrowing, confirm: 'Are you sure?', method: :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New Borrowing', new_borrowing_path %>
<%= link_to 'Back', librarian_path %>
